package org.example.springioc.Controller;

/**
 * Setter 方法注入
 */

import jakarta.annotation.Resource;
import org.example.springioc.Service.UserService;
import org.example.springioc.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;

@Controller
public class UserController3 {

    @Resource(name = "user2")
    private User user;

    private UserService userService;

    //@Autowired
//    public void setUserService(UserService userService) {
//        this.userService = userService;
//    }

    public void hello(){
        System.out.println("hello UserController3");
        userService.hello();
    }
}
